package com.caojing.syby.ui.account;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.caojing.syby.R;
import com.caojing.syby.base.BaseFragment;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 个人中心碎片
 */
public class AccountFragment extends BaseFragment {


    @Bind(R.id.btn_account_login)
    Button btnAccountLogin;
    @Bind(R.id.rl_account_indent)
    RelativeLayout rlAccountIndent;
    @Bind(R.id.rl_account_loginstics)
    RelativeLayout rlAccountLoginstics;
    @Bind(R.id.rl_account_shop)
    RelativeLayout rlAccountShop;
    @Bind(R.id.rl_account_collects)
    RelativeLayout rlAccountCollects;
    @Bind(R.id.rl_account_clear)
    RelativeLayout rlAccountClear;
    @Bind(R.id.tv_account_update_versions)
    TextView tvAccountUpdateVersions;
    @Bind(R.id.rl_account_update)
    RelativeLayout rlAccountUpdate;
    @Bind(R.id.rl_account_aboutus)
    RelativeLayout rlAccountAboutus;
    @Bind(R.id.tv_account_select_girl)
    TextView tvAccountSelectGirl;

    public AccountFragment() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_account;
    }

    @Override
    protected void initView(View view) {

    }

    @Override
    protected void initData() {

    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @OnClick({R.id.btn_account_login, R.id.tv_account_select_girl,R.id.rl_account_indent, R.id.rl_account_loginstics, R.id.rl_account_shop, R.id.rl_account_collects, R.id.rl_account_clear, R.id.tv_account_update_versions, R.id.rl_account_update, R.id.rl_account_aboutus})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_account_login:
                //立刻登录
                startActivity(new Intent(getActivity(),EnterNowActivity.class));
                break;
            case R.id.tv_account_select_girl:
                //选择美女
                startActivityForResult(new Intent(getActivity(),SelectIdentityActivity.class),1);
                break;
            case R.id.rl_account_indent:
                //查看订单
                startActivity(new Intent(getActivity(),LookIndentActivity.class));
                break;
            case R.id.rl_account_loginstics:
                //查看物流
                startActivity(new Intent(getActivity(),LookLogisticsActivity.class));
                break;
            case R.id.rl_account_shop:
                //查看我的购物车
                startActivity(new Intent(getActivity(),LookMyCartActivity.class));
                break;
            case R.id.rl_account_collects:
                //查看我的收藏
                startActivity(new Intent(getActivity(),LookStoreUpActivity.class));
                break;
            case R.id.rl_account_clear:
                break;
            case R.id.tv_account_update_versions:
                break;
            case R.id.rl_account_update:
                break;
            case R.id.rl_account_aboutus:
                //关于十元包邮
                startActivity(new Intent(getActivity(),AboutusTenYuanActivity.class));

                break;
        }

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode==1&&resultCode==2){
            String sax = data.getStringExtra("sex");
            tvAccountSelectGirl.setText(sax);
        }
    }
}
